<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>womStat</title>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/bazaar.css">
    <link rel="stylesheet" href="./css/font-awesome-4.7.0/css/font-awesome.css">
    <link rel="stylesheet" href="css/layui/css/layui.css">
    <style>
        body,html{
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <div id="six-header">
        <p class="six-bazaar">口碑统计</p>
    </div>
    <div id="six-footer">
        <div class="six-statistics">
            <div class="six-classify">
                <a id="active-1" class="six-a1" href="javascript:void(0)">登记量和报名量统计</a>
                <a class="six-a1" href="javascript:void(0)">退单统计</a>
                <a class="six-a1" href="javascript:void(0)">咨询量统计</a>
            </div>
            <div id="six-date">
                <p class="six-select">日期选择：</p>
                <p id="active" class="six-a4" href="">本月</p>
                <p id="shangyue" class="six-a5 six-a4" href="">上月</p>
                <p class="six-time">选择日期</p>
                <div class="six-case"><span class="fa fa-calendar"></span><input type="text" class="layui-input" id="beginday" placeholder="开始日期"></div>
                <div class="he">-</div>
                <div class="six-case1"><span class="fa fa-calendar"></span><input type="text" class="layui-input" id="beginday1" placeholder="结束日期"></div>
            </div>
            <div id="six-form">
                <table id="six-tab">
                    <tr>
                        <th>地区</th>
                        <th>Java</th>
                        <th>Java精英班</th>
                        <th>Web大前端</th>
                        <th>UI视觉设计</th>
                        <th>大数据</th>
                        <th>Python课程</th>
                        <th>Unity3D</th>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</body>
<script src="./js/jquery-3.4.1.js"></script>
<script src="./js/ipUrl.js"></script>
<script src="css/layui/layui.js"></script>
<script src="./js/bazaar.js"></script>
<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#beginday'
        });
    });
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#beginday1'
        });
    });

    $(function(){
        $.ajax({
            url: womStateURL+':9999/oaSystem/womStat',
            type: "post",
            dataType: "json",
            data: {
                method: 'cMonth'
            },
            success: function (data) {
                // console.log(data)
                if (data.code == 200) {
                    // console.log(data.result)
                    var a = data.result;
                    $('th').parent().siblings().remove();
                    for (var k in a) {
                        $('<tr><td>'+ k +'</td><td>'+ (a[k].Java || 0) +'</td><td>'+ (a[k].Java大数据 || 0) +'</td><td>'+ (a[k].Html || 0) +'</td><td>'+ (a[k].UI || 0) +'</td><td>'+ (a[k].bigDataCount || 0) +'</td><td>'+ (a[k].Python || 0) +'</td><td>'+ (a[k].UI3D || 0) +'</td></tr>').appendTo('table')
                        }
                }
            },
            error: function (xhr) {
                console.log('失败')
            }
        })
    })
    
    $('#thisMonth').click(function () {
        $.ajax({
            url: womStateURL+':9999/oaSystem/womStat',
            type: "post",
            dataType: "json",
            data: {
                method: 'cMonth'
            },
            success: function (data) {
                // console.log(data)
                if (data.code == 200) {
                    // console.log(data.result)
                    var a = data.result;
                    $('th').parent().siblings().remove();
                    for (var k in a) {
                        $('<tr><td>'+ k +'</td><td>'+ (a[k].Java || 0) +'</td><td>'+ (a[k].Java大数据 || 0) +'</td><td>'+ (a[k].Html || 0) +'</td><td>'+ (a[k].UI || 0) +'</td><td>'+ (a[k].bigDataCount || 0) +'</td><td>'+ (a[k].Python || 0) +'</td><td>'+ (a[k].UI3D || 0) +'</td></tr>').appendTo('table')
                        }
                }
            },
            error: function (xhr) {
                console.log('失败')
            }
        })
    })

    $('#precedMonth').click(function () {
        $.ajax({
            url: womStateURL+':9999/oaSystem/womStat',
            type: "post",
            dataType: "json",
            data: {
                method: 'cMonth'
            },
            success: function (data) {
                // console.log(data)
                if (data.code == 200) {
                    // console.log(data.result)
                    var a = data.result;
                    $('th').parent().siblings().remove();
                    for (var k in a) {
                        $('<tr><td>'+ k +'</td><td>'+ (a[k].Java || 0) +'</td><td>'+ (a[k].Java大数据 || 0) +'</td><td>'+ (a[k].Html || 0) +'</td><td>'+ (a[k].UI || 0) +'</td><td>'+ (a[k].bigDataCount || 0) +'</td><td>'+ (a[k].Python || 0) +'</td><td>'+ (a[k].UI3D || 0) +'</td></tr>').appendTo('table')
                        }
                }
            },
            error: function (xhr) {
                console.log('失败')
            }
        })
    })

    $('#beginday1').click(function () {
        $('#layui-laydate2 td').unbind();
        $('#layui-laydate2 td').click(function () {
            // alert(1)
            console.log($('#beginday').val())
            console.log($('#beginday1').val())
            if ($('#beginday1').val() >= $('#beginday').val()) {
                $.ajax({
                    type: "post",
                    url: womStateURL+':9999/oaSystem/womStat',
                    dataType: "json",
                    data: {
                        'beginTime': $('#beginday').val(),
                        'endTume': $('#beginday1').val()
                    },
                    success: function (data) {
                        console.log(data)
                        if (data.code == 200) {
                            console.log(data.result)
                            var a = data.result;
                            $('th').parent().siblings().remove();
                            for (var k in a) {
                                $('<tr><td>' + k + '</td><td>' + a[k].javaCount + '</td><td>' + a[k].javaJyCount + '</td><td>' + a[k].webQdCount + '</td><td>' + a[k].uiCount + '</td><td>' + a[k].bigDataCount + '</td><td>' + a[k].pythonCount + '</td><td>' + a[k].unity3dCount + '</td></tr>').appendTo('table')
                            }
                        }
                    },
                    error: function (xhr) {
                        console.log('失败')
                    }
                })
            } else if ($('#beginday1').val() < $('#beginday').val()) {
                alert('false')
            }
        })
    })

    $('#beginday').click(function () {
        $('#layui-laydate1 td').unbind();
        $('#layui-laydate1 td').click(function () {
            // alert(1)
            console.log($('#beginday').val())
            console.log($('#beginday1').val())
            if ($('#beginday1').val() >= $('#beginday').val()) {
                $.ajax({
                    type: "post",
                    url: womStateURL+':9999/oaSystem/womStat',
                    dataType: "json",
                    data: {
                        'beginTime': $('#beginday').val(),
                        'endTume': $('#beginday1').val()
                    },
                    success: function (data) {
                        console.log(data)
                        if (data.code == 200) {
                            console.log(data.result)
                            var a = data.result;
                            $('th').parent().siblings().remove();
                            for (var k in a) {
                                $('<tr><td>' + k + '</td><td>' + a[k].javaCount + '</td><td>' + a[k].javaJyCount + '</td><td>' + a[k].webQdCount + '</td><td>' + a[k].uiCount + '</td><td>' + a[k].bigDataCount + '</td><td>' + a[k].pythonCount + '</td><td>' + a[k].unity3dCount + '</td></tr>').appendTo('table')
                            }
                        }
                    },
                    error: function (xhr) {
                        console.log('失败')
                    }
                })
            } else if ($('#beginday1').val() < $('#beginday').val()) {
                alert('false')
            }
        })
    })
</script>
</html>